<template>
  <h1>El-单选组件</h1>
  <el-radio-group v-model="edu">
    <el-radio value="初中">学历:初中</el-radio>
    <el-radio label="学历:高中" value="高中"></el-radio>
    <el-radio label="学历:大学" value="大学"></el-radio>
    <el-radio label="学历:硕士" value="硕士"></el-radio>
  </el-radio-group>
  <h4>您选择的学历是：{{edu}}</h4>
  <el-radio-group v-model="goods">
    <el-radio-button v-for="item in arr" :label="item.title" :value="item.price"></el-radio-button>
  </el-radio-group>
  <h4>您选择的酒的价格是:{{goods}}</h4>
</template>

<script setup>
import {ref} from "vue";

const edu = ref('高中');

//定义一个数组用来模拟后端查询回来的商品数据
const arr = ref([
  {title:'五粮液',price:'￥88.00'},
  {title: '剑南春',price:'￥78.00'},
  {title: '郎酒',price:'￥68.00'},
  {title: '茅台',price:'￥98.00'},
  {title: '二锅头',price:'￥48.00'},
  {title: '汾酒',price:'￥38.00'}
]);
//定义一个变量用作双向绑定,收集单选组的值
const goods = ref('￥38.00');
</script>

<style scoped>

</style>